package com.kirk.cts.ui.widget;

import com.kirk.cts.core.constants.SystemConstants;
import com.kirk.cts.core.loader.ImageLoader;
import com.kirk.cts.core.loader.LanguageLoader;

import javax.swing.*;
import java.awt.*;


/**
 * <p> MainFrame.java </p>
 *
 * @version 1.0.0
 * @Author kirkliu
 * @Date 2020-09-01 22:57
 * @Description 窗口基类
 */
public class MainFrame extends JFrame {

    private static final long serialVersionUID = 1L;

    public MainFrame() {
        super(LanguageLoader.getString("CrawlerMainFrame.title"));
        setSize(SystemConstants.FRAME_DEFAULT_WIDTH, SystemConstants.FRAME_DEFAULT_HEIGHT);
        setIconImage(ImageLoader.getImage("CrawlerResource.logo"));
    }

    public MainFrame(String title) {
        super(title);
        setSize(SystemConstants.FRAME_DEFAULT_WIDTH, SystemConstants.FRAME_DEFAULT_HEIGHT);
        setIconImage(ImageLoader.getImage("CrawlerResource.logo"));
    }

    public MainFrame(String title, Integer width, Integer height) {
        super(title);
        setSize(width, height);
        setIconImage(ImageLoader.getImage("CrawlerResource.logo"));
    }

    public MainFrame(String title, Integer width, Integer height, Component owner) {
        super(title);
        setSize((null == width) ? SystemConstants.FRAME_DEFAULT_WIDTH : width, (null == height) ? SystemConstants.FRAME_DEFAULT_HEIGHT : height);
        setLocationRelativeTo(owner);
        setIconImage(ImageLoader.getImage("CrawlerResource.logo"));
    }


}
